package com.os.objectFactory;

import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.log4j.Logger;

import java.util.List;
import java.util.Properties;
import java.util.PropertyPermission;

/**
 * @Author Matt
 * @Date 2022-06-26
 * @Desc:
 * @Version V1.0
 */
public class MyObjectFactory extends DefaultObjectFactory {

    private static final long serialVersionUID = -381487216040286292L;
    Logger log = Logger.getLogger(MyObjectFactory.class);

    @Override
    public <T> T create(Class<T> type) {
        log.info("使用定制工厂的create方法构建单个对象");
        return super.create(type);
    }

    @Override
    public <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
        log.info("使用定制工厂的create方法构建列表对象");
        return super.create(type, constructorArgTypes, constructorArgs);
    }

    @Override
    public void setProperties(Properties properties) {
        log.info("定制属性：" + properties);
        super.setProperties(properties);
    }

    @Override
    public <T> boolean isCollection(Class<T> type) {
        return super.isCollection(type);
    }
}
